<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
  <link rel="stylesheet" href="../../../layui/css/layui.css" media="all"/>
  <link rel="stylesheet" href="../../../css/public.css" media="all"/>
  <link rel="stylesheet" href="../../common/zTreeStyle.css"/>
  <link rel="stylesheet" href="edit.css"/>
</head>

<body class="childrenBody" style="background: white;">
<div class="topsty">
  <div style="display: inline;">
				<span style="font-size: 15px;">
					<i class="layui-icon" style="color: #1E9FFF;margin:0 10px 0 30px;">&#xe65b;</i>
					<span id="pageTitle">上传试题</span>
				</span>
  </div>
  <div class="backtit" style="top: -5px;">
    <div class="back_san"></div>
    <a onclick="history.go(-1)" class="layui-btn layui-btn-normal">返回</a>
  </div>
</div>
<div class="body">
  <form class="layui-form" style="margin-top: 14px;margin-bottom: 15px;">
    <div class="layui-form-item">
      <div class="layui-inline">
        <label class="layui-form-label">业务分类</label>
        <div class="layui-input-inline">
          <select id="differServ">
          </select>
        </div>
      </div>
      <div class="layui-inline">
        <label class="layui-form-label">试题分类</label>
        <div class="layui-input-inline">
          <select id="typeName">
          </select>
        </div>
      </div>
      <div class="layui-inline">
        <label class="layui-form-label">题型</label>
        <div class="layui-input-inline">
          <select id="questionType" lay-filter="questionType">
            <option value="0">单选题</option>
            <option value="1">多选题</option>
            <option value="2">判断题</option>
          </select>
        </div>
      </div>
    </div>
    <div class="layui-form-item layui-form-text">
      <label class="layui-form-label">题干</label>
      <div class="layui-input-block">
        <textarea id="title" placeholder="请输入题干" class="layui-textarea"></textarea>
        <!--<input id="fileId" type="file">-->
        <button type="button" class="layui-btn layui-btn-normal file">选择图片</button>
        <div style="display:inline-block;position:relative;margin-top:10px;margin-left:20px;" v-for="item in info.fileId">
          <div :id="item" class="delImg"
               style="position:absolute;top:-4px;right:-5px;color:white;background:red;border:1px solid red;border-radius:50%;width:16px;height:16px">
            <i class="layui-icon" style="position:relative;top:0px;right:0px;">ဆ</i></div>
          <img :id="'pic'+item" :src="baseurl + 'attachment/seekFile/' + item"
               width="100px" height="100px" class="picsty">
        </div>
      </div>
    </div>
    <div class="layui-form-item" pane="">
      <label class="layui-form-label">选项</label>
      <div class="layui-input-block option" v-for="item in list">
        <label>{{item.key}}</label>
        <input :type="questionType == 1?'checkbox':'radio'" name="option" lay-skin="primary" :checked="item.answer==1">
        <span class="type_option">
							<input v-show="item.questionType != 2" type="text" name="title" lay-verify="title" autocomplete="off"
                     placeholder="请输入标题"
                     class="layui-input option_input" :value="item.value">
							<span v-show="item.questionType == 2">正确</span>
						</span>
        <i class="seraph icon-guanbi"></i>
        <span class="true" v-show="item.answer==1">【正解】</span>
        <button type="button" class="layui-btn layui-btn-normal file">选择图片</button>
        <div style="display:inline-block;position:relative;margin-top:10px;margin-left:20px;" v-for="it in item.fileId">
          <div :id="it" class="delImg"
               style="position:absolute;top:-4px;right:-5px;color:white;background:red;border:1px solid red;border-radius:50%;width:16px;height:16px">
            <i class="layui-icon" style="position:relative;top:0px;right:0px;">ဆ</i></div>
          <img :id="'pic'+it" :src="baseurl + 'attachment/seekFile/' + it"
               width="100px" height="100px" class="picsty">
        </div>
      </div>

      <div class="add_option">
        <div class="box">
          <div class="rctd-add"></div>
          添加选项
        </div>
      </div>
    </div>
    <div class="layui-form-item layui-form-text">
      <label class="layui-form-label">解析</label>
      <div class="layui-input-block">
        <textarea id="parse" placeholder="请填写题目解析、思路解释，便于后期交流、讨论，不会显示给考生。（选填）" class="layui-textarea"></textarea>
        <button type="button" class="layui-btn layui-btn-normal file">选择图片</button>
        <div style="display:inline-block;position:relative;margin-top:10px;margin-left:20px;" v-for="item in info.parseFileId">
          <div :id="item" class="delImg"
               style="position:absolute;top:-4px;right:-5px;color:white;background:red;border:1px solid red;border-radius:50%;width:16px;height:16px">
            <i class="layui-icon" style="position:relative;top:0px;right:0px;">ဆ</i></div>
          <img :id="'pic'+item" :src="baseurl + 'attachment/seekFile/' + item"
               width="100px" height="100px" class="picsty">
        </div>
      </div>
      <div class="commit">提交</div>
    </div>
  </form>

</div>
<script type="text/javascript" src="../../common/jquery.min.js"></script>
<script type="text/javascript" src="../../common/config.js"></script>
<script type="text/javascript" src="../../../layui/layui.js"></script>
<script type="text/javascript" src="../../common/jquery.ztree.core.js"></script>
<script type="text/javascript" src="../../common/jquery.ztree.excheck.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript" src="edit.js"></script>

<script>
  layui.use(['form', 'layedit', 'laydate'], function () {
    var form = layui.form
        , layer = layui.layer
        , layedit = layui.layedit
        , laydate = layui.laydate;

    //创建一个编辑器
    var editIndex = layedit.build('LAY_demo_editor');

    //自定义验证规则
    form.verify({
      title: function (value) {
        if (value.length < 5) {
          return '标题至少得5个字符啊';
        }
      }
      , pass: [/(.+){6,12}$/, '密码必须6到12位']
      , content: function (value) {
        layedit.sync(editIndex);
      }
    });

    //监听指定开关
    form.on('switch(switchTest)', function (data) {
      layer.msg('开关checked：' + (this.checked ? 'true' : 'false'), {
        offset: '6px'
      });
      layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
    });

    //监听提交
    form.on('submit(demo1)', function (data) {
      layer.alert(JSON.stringify(data.field), {
        title: '最终的提交信息'
      })
      return false;
    });

  });


</script>
</body>

</html>